Conversation
📝 WalkthroughWalkthrough
Changes
Sequence Diagram(s)sequenceDiagram
participant CodeDeploy
participant EC2
participant pre_install.sh
participant Docker
CodeDeploy->>EC2: BeforeInstall 훅 트리거
EC2->>pre_install.sh: 스크립트 실행
pre_install.sh->>Docker: 컨테이너 상태 확인 (ELK, Filebeat)
alt 컨테이너 중 하나라도 비정상
pre_install.sh->>Docker: docker-compose로 컨테이너 재시작
else 모두 정상
pre_install.sh->>EC2: "모든 컨테이너 정상" 메시지 출력
end
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
scripts/pre_install.sh (2)
8-13: 컨테이너 이름 변수 미인용 및 반복 코드 개선 제안
- 변수 확장은 따옴표로 감싸는 것이 안전합니다.
- 컨테이너 목록을 배열로 선언하면 가독성과 유지보수성이 높아집니다.
-NEED_RESTART=0 -for CONTAINER in pitchain_filebeat pitchain_logstash pitchain_kibana pitchain_elasticsearch; do - if ! docker ps --format '{{.Names}}' | grep -q "^${CONTAINER}$"; then +NEED_RESTART=0 +CONTAINERS=(pitchain_filebeat pitchain_logstash pitchain_kibana pitchain_elasticsearch) +for CONTAINER in "${CONTAINERS[@]}"; do + if ! docker ps --format '{{.Names}}' | grep -q "^${CONTAINER}$"; then echo "$CONTAINER 컨테이너가 실행 중이 아닙니다." NEED_RESTART=1 fi done
15-18: 모든 컨테이너를 재빌드·재기동하는 것은 과도할 수 있습니다다운된 컨테이너만 선택적으로
docker compose restart(또는up -d) 하면 배포 시간이 단축되고 불필요한 이미지 빌드를 피할 수 있습니다.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
appspec.yml(1 hunks)scripts/pre_install.sh(1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
scripts/pre_install.sh
[warning] 5-5: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
(SC2164)
🔇 Additional comments (1)
appspec.yml (1)
15-18:BeforeInstall훅 추가는 적절하지만,ApplicationStop단계가 누락되었습니다CodeDeploy 표준 순서는
ApplicationStop → BeforeInstall → AfterInstall → ApplicationStart입니다.
stop.sh가AfterInstall에 남아 있으면 새 버전 코드 복사 후에 기존 컨테이너를 중지하게 되어 다운타임이 길어질 수 있습니다.ApplicationStop으로 이동하는 방안을 검토해주세요.
⭐ Summary
📌 Tasks
## ETC - codedeploy appspec에서 hooks 옵션을 통해 순서를 조정해줄 수 있어서 이를 활용했습니다. - ELK+Filebeat 중 하나 이상의 컨테이너가 다운된 경우에만 재실행되도록 설정해놨습니다